package com.gm.controller;

import com.gm.entity.Employee;
import com.gm.mapper.EmpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Administrator
 * @Date 2020/6/19 14:23
 **/
@RestController
public class EmpController {
    @Autowired
    EmpMapper empMapper;

    @GetMapping("/emp/{id}")
    public Employee getEmployee(@PathVariable("id") Integer id){
        return  empMapper.getEmpById(id);
    }
    @GetMapping("/emp")
    public Employee addEmp(Employee employee){
        empMapper.addEmp(employee);
        return employee;
    }
}
